$(document).ready(function() {
	
	$(".button").button();
		
	$(".buttonset").buttonset();

	$(".button.add").button({
		icons : { primary : "ui-icon-circle-plus" },
		text : true
	});
	
	$(".button.view").button({
		icons : { primary : "ui-icon-zoomin" },
		text : false
	});
	
	$(".button.edit").button({
		icons : { primary : "ui-icon-pencil" },
		text : false
	});
	
	$(".button.delete").button({
		icons : { primary : 'ui-icon-trash' },
		text : false
	});

	$("form input[type=submit]").button();

	$(".message .close").click(function() {
		$(this).parent().fadeOut('slow');
		return false;
	});
	
	$(".tabs").tabs();
	
});


/*
 * Validate Forms
 * jQuery Validation Plugin
 * @link http://docs.jquery.com/Plugins/Validation
 */
var formValidations = {
	Spot : {
		errorClass : "invalid",
		rules : {
			"data[Spot][name]" : "required"
		},
		messages : {
			"data[Spot][name]" : "Please, enter a name for the Spot."
		}
	},
	Category : {
		errorClass : "invalid",
		rules : {
			"data[Category][name]" : "required"
		},
		messages : {
			"data[Category][name]" : "Please, enter a name for the Category."
		}
	},
	City : {
		errorClass : "invalid",
		rules : {
			"data[City][name]" : "required",
			"data[City][latitude]" : "number",
			"data[City][longitude]" : "number"
		},
		messages : {
			"data[City][name]" : "Please, enter a name for the City."
		}
	}
};